<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019-10-18
 * Time: 13:59
 */
namespace app\manage\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class Vote extends Validate
{
    //定义验证规则
    protected $rule = [
        'title|投票标题'  => 'require',
        'type|选项类型'  => 'require',
        'start_time|开始时间'  => 'require',
        'end_time|结束时间'  => 'require',
        'content|投票内容'   => 'require',
        'choice|选项内容'   => 'require',
        'status|投票状态'   => 'require',
        'people_type|投票人'   => 'require',
        '__token__' => 'token',
    ];

    //定义验证提示
    protected $message = [
        'title.require' => '请输入投票标题',
        'type.require' => '请选择选项类型',
        'start_time.require' => '请选择投票开始时间',
        'end_time.require' => '请选择投票结束时间',
        'content.require' => '请输入投票详情',
        'choice.require' => '请输入选项内容',
        'status.require' => '请选择投票状态',
        'people_type.require' => '投票人未选择',

    ];

    //定义验证场景
    protected $scene = [
        //更新
        'add'  =>  ['title','content','type','start_time','start_time','end_time','choice','status','people_type'],
    ];
}
